﻿namespace System.Windows.Data
{
    /// <summary>
    /// <see cref="Boolean">Boolean</see> to opacity <see cref="IValueConverter">value converter</see>.
    /// </summary>
    public class BooleanToOpacityConverter : RevertibleBooleanToAnythingConverter
    {
        #region Overrides of RevertibleBooleanToAnythingConverter

        /// <summary>
        /// Direct value for conversion.
        /// </summary>
        protected override object DirectValue
        {
            get { return 1; }
        }

        /// <summary>
        /// Opposite-to-Direct value for conversion.
        /// </summary>
        protected override object OppositeValue
        {
            get { return 0; }
        }

        /// <summary>
        /// Determines whether value is DirectValue.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <returns>True, if DirectValue, otherwise - false.</returns>
        protected override bool IsDirectValue(object value)
        {
            return (int)value == 1;
        }

        #endregion
    }
}
